144 if(pos+10>buf_size) pos=buf_size;
169 const int qscale= s->
qscale;
283 }
else if(bits_left != 1){
285 v|= 0x7F >> (7-(bits_count&7));
287 if(v==0x7F && bits_left<=8)
316 max_extra+= 256*256*256*64;
339 void *
data,
int *data_size,
342 const uint8_t *buf = avpkt->
data;
343 int buf_size = avpkt->
size;
348 #ifdef PRINT_FRAME_TIME
349 uint64_t
time= rdtsc();
496 #define SET_QPEL_FUNC(postfix1, postfix2) \
497 s->dsp.put_ ## postfix1 = ff_put_ ## postfix2;\
498 s->dsp.put_no_rnd_ ## postfix1 = ff_put_no_rnd_ ## postfix2;\
499 s->dsp.avg_ ## postfix1 = ff_avg_ ## postfix2;
649 if(ret<0)
return ret;
650 if(ret==1)
goto intrax8_decoded;
686 int startcode_found=0;
688 if(buf_size - current_pos > 5){
690 for(i=current_pos; i<buf_size-3; i++){
691 if(buf[i]==0 && buf[i+1]==0 && buf[i+2]==1 && buf[i+3]==0xB6){
737 #ifdef PRINT_FRAME_TIME
int bitstream_buffer_size
enum PixelFormat pix_fmt
Pixel format, see PIX_FMT_xxx.
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 AVERROR_INVALIDDATA
Invalid data found when processing input.
#define FF_BUG_XVID_ILACE
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 if lowres enabled.
av_cold int ff_dct_common_init(MpegEncContext *s)
#define SLICE_NOEND
no end marker or error found but mb count exceeded
static void skip_bits_long(GetBitContext *s, int n)
static int decode_slice(MpegEncContext *s)
enum PixelFormat(* get_format)(struct AVCodecContext *s, const enum PixelFormat *fmt)
callback to negotiate the pixelFormat
int msmpeg4_version
0=not msmpeg4, 1=mp41, 2=mp42, 3=mp43/divx3 4=wmv1/7 5=wmv2/8
uint8_t * bitstream_buffer
#define FF_BUG_HPEL_CHROMA
void ff_vdpau_mpeg4_decode_picture(MpegEncContext *s, const uint8_t *buf, int buf_size)
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
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer, reusing the given one if large enough.
AVHWAccel * ff_find_hwaccel(enum CodecID codec_id, enum PixelFormat pix_fmt)
Return the hardware accelerated codec for codec codec_id and pixel format pix_fmt.
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.
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
enum OutputFormat out_format
output format
enum PixelFormat ff_hwaccel_pixfmt_list_420[]
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
#define FF_BUG_QPEL_CHROMA2
static int get_bits_count(const GetBitContext *s)
int flags2
AVCodecContext.flags2.
int mb_height
number of MBs horizontally & vertically
int lowres
low resolution decoding, 1-> 1/2 size, 2->1/4 size
int codec_tag
internal codec_tag upper case converted from avctx codec_tag
void MPV_common_end(MpegEncContext *s)
int ff_wmv2_decode_picture_header(MpegEncContext *s)
enum AVChromaLocation chroma_sample_location
This defines the location of chroma samples.
void avcodec_set_dimensions(AVCodecContext *s, int width, int height)
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.
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
uint8_t * error_status_table
table of the error status of each MB
#define FF_BUG_DIRECT_BLOCKSIZE
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...
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]
#define CODEC_CAP_TRUNCATED
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 active_thread_type
Which multithreading methods are in use by the codec.
int capabilities
Codec capabilities.
int ff_wmv2_decode_secondary_picture_header(MpegEncContext *s)
#define FF_BUG_NO_PADDING
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
#define CODEC_FLAG_TRUNCATED
int msmpeg4_decode_ext_header(MpegEncContext *s, int buf_size)
void MPV_decode_mb(MpegEncContext *s, DCTELEM block[12][64])
int ff_flv_decode_picture_header(MpegEncContext *s)
void MPV_frame_end(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 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_THREAD_FRAME
Decode more than one frame at once.
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
void MPV_decode_defaults(MpegEncContext *s)
Set the given MpegEncContext to defaults for decoding.
struct AVFrame AVFrame
Audio Video Frame.
int idct_algo
IDCT algorithm, see FF_IDCT_* below.
int msmpeg4_decode_picture_header(MpegEncContext *s)
Picture * current_picture_ptr
pointer to the current picture
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)
#define SET_QPEL_FUNC(postfix1, postfix2)
#define FF_BUG_QPEL_CHROMA
av_cold int MPV_common_init(MpegEncContext *s)
init common structure for both encoder and decoder.
av_cold int ff_h263_decode_end(AVCodecContext *avctx)
#define AVERROR_PATCHWELCOME
Not yet implemented in Libav, patches welcome.
#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
discard all non reference
main external API structure.
#define AV_CPU_FLAG_MMX
standard MMX
static void close(AVCodecParserContext *s)
int height
picture size. must be a multiple of 16
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
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
void ff_draw_horiz_band(MpegEncContext *s, int y, int h)
#define CODEC_CAP_DRAW_HORIZ_BAND
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
int slice_height
in macroblocks
void ff_er_frame_start(MpegEncContext *s)
DSPContext dsp
pointers for accelerated dsp functions
int ff_h263_decode_picture_header(MpegEncContext *s)
#define FF_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
#define CODEC_CAP_HWACCEL_VDPAU
Codec can export data for HW decoding (VDPAU).
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
#define FF_BUG_AUTODETECT
autodetection
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.
enum PixelFormat * pix_fmts
array of supported pixel formats, or NULL if unknown, array is terminated by -1
qpel_mc_func(* qpel_avg)[16]
Picture * next_picture_ptr
pointer to the next picture (for bidir pred)
struct AVCodecContext * avctx
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 AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
static av_cold void flush(AVCodecContext *avctx)
Flush (reset) the frame ID after seeking.
const uint8_t * buffer_end
int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
Picture * last_picture_ptr
pointer to the previous picture.
int workaround_bugs
Work around bugs in encoders which sometimes cannot be detected automatically.
void MPV_report_decode_progress(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
#define CODEC_FLAG2_FAST
Allow non spec compliant speedup tricks.
int flags
AVCodecContext.flags (HQ, MV4, ...)
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_mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size)
Find the end of the current frame in the bitstream.
discard all frames except keyframes
#define CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
#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)
void av_log_missing_feature(void *avc, const char *feature, int want_sample)
Log a generic warning message about a missing feature.
int 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(* end_frame)(AVCodecContext *avctx)
Called at the end of each frame or field picture.