28 #include "libavutil/avassert.h"
34 #define H261_MBA_VLC_BITS 9
35 #define H261_MTYPE_VLC_BITS 6
36 #define H261_MV_VLC_BITS 7
37 #define H261_CBP_VLC_BITS 9
38 #define TCOEFF_VLC_BITS 9
39 #define MBA_STUFFING 33
40 #define MBA_STARTCODE 34
171 for (; left > 15 + 1 + 4 + 5; left -= 8) {
199 for (i = mba1; i < mba2; i++) {
208 for (j = 0; j < 6; j++)
226 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -16
237 mv_diff =
mvmap[mv_diff];
273 if ((level & 0x7F) == 0) {
293 block[0] = (check & 0x1) ? -1 : 1;
317 }
else if (code == 0) {
437 for (i = 0; i < 6; i++) {
443 for (i = 0; i < 6; i++)
460 uint32_t startcode = 0;
463 startcode = ((startcode << 1) |
get_bits(&s->
gb, 1)) & 0x000FFFFF;
465 if (startcode == 0x10)
469 if (startcode != 0x10) {
558 if (pos + 10 > buf_size)
568 int buf_size = avpkt->
size;
575 av_dlog(avctx,
"bytes=%x %x %x %x\n", buf[0], buf[1], buf[2], buf[3]);
const char const char void * val
discard all frames except keyframes
void ff_init_block_index(MpegEncContext *s)
#define H261_CBP_VLC_BITS
This structure describes decoded (raw) audio or video data.
static int get_consumed_bytes(MpegEncContext *s, int buf_size)
returns the number of bytes consumed for building the current frame
int coded_width
Bitstream width / height, may be different from width/height e.g.
#define H261_MBA_VLC_BITS
av_cold int ff_MPV_common_init(MpegEncContext *s)
init common structure for both encoder and decoder.
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static av_cold int init(AVCodecContext *avctx)
const uint8_t ff_h261_mba_bits[35]
void avcodec_set_dimensions(AVCodecContext *s, int width, int height)
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
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)
const int8_t * table_level
int mb_num
number of MBs of a picture
const uint8_t ff_h261_mba_code[35]
static int get_sbits(GetBitContext *s, int n)
static VLC h261_mtype_vlc
const uint8_t ff_h261_cbp_tab[63][2]
static int h261_decode_picture_header(H261Context *h)
Decode the H.261 picture header.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
enum AVDiscard skip_frame
Skip decoding for selected frames.
#define INIT_VLC_STATIC(vlc, bits, a, b, c, d, e, f, g, static_size)
enum OutputFormat out_format
output format
static int h261_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
const char * name
Name of the codec implementation.
int av_frame_ref(AVFrame *dst, AVFrame *src)
Setup a new reference to the data described by a given frame.
Picture current_picture
copy of the current picture structure.
GetBitContext last_resync_gb
used to search for the next resync marker
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
static int get_bits_count(const GetBitContext *s)
static int h261_decode_block(H261Context *h, int16_t *block, int n, int coded)
Decode a macroblock.
int flags2
AVCodecContext.flags2.
int mb_height
number of MBs horizontally & vertically
void ff_MPV_frame_end(MpegEncContext *s)
static av_cold void h261_decode_init_vlc(H261Context *h)
static void ff_update_block_index(MpegEncContext *s)
void ff_set_qscale(MpegEncContext *s, int qscale)
set qscale and update qscale dependent variables.
av_cold void ff_h261_common_init(void)
static int get_bits_left(GetBitContext *gb)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static av_cold int h261_decode_init(AVCodecContext *avctx)
int mb_skipped
MUST BE SET only during DECODING.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
int low_delay
no reordering needed / has no b-frames
VLC vlc
decoding only deprecated FIXME remove
#define INIT_VLC_RL(rl, static_size)
Libavcodec external API header.
#define FF_ARRAY_ELEMS(a)
int n
number of entries of table_vlc minus 1
void ff_mpeg_er_frame_start(MpegEncContext *s)
enum AVPictureType pict_type
Picture type of the frame.
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
static const int mvmap[17]
void(* clear_blocks)(int16_t *blocks)
Picture * current_picture_ptr
pointer to the current picture
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
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
const uint8_t ff_h261_mtype_code[10]
static av_cold int h261_decode_end(AVCodecContext *avctx)
const uint8_t ff_h261_mtype_bits[10]
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...
static int h261_decode_gob_header(H261Context *h)
Decode the group of blocks header or slice header.
const uint8_t ff_h261_mv_tab[17][2]
#define MV_TYPE_16X16
1 vector for the whole mb
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
const int ff_h261_mtype_map[10]
main external API structure.
static void close(AVCodecParserContext *s)
ScanTable intra_scantable
#define AV_EF_BITSTREAM
detect bitstream specification deviations
int height
picture size. must be a multiple of 16
void ff_print_debug_info(MpegEncContext *s, Picture *p, AVFrame *pict)
#define SLICE_END
end marker found
Picture * picture
main picture buffer
static int h261_decode_gob(H261Context *h)
static unsigned int get_bits1(GetBitContext *s)
static void skip_bits1(GetBitContext *s)
void ff_MPV_decode_mb(MpegEncContext *s, int16_t block[12][64])
static void skip_bits(GetBitContext *s, int n)
rational number numerator/denominator
static int h261_resync(H261Context *h)
Decode the group of blocks / video packet header.
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
DSPContext dsp
pointers for accelerated dsp functions
#define H261_MTYPE_VLC_BITS
RLTable ff_h261_rl_tcoeff
int pict_type
AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, ...
int gob_start_code_skipped
int mv[2][4][2]
motion vectors for a macroblock first coordinate : 0 = forward 1 = backward second " : depend...
struct AVCodecContext * avctx
discard all non reference
int mb_stride
mb_width+1 used for some arrays to allow simple addressing of left & top MBs without sig11 ...
static int h261_decode_mb(H261Context *h)
static int decode_mv_component(GetBitContext *gb, int v)
void ff_MPV_common_end(MpegEncContext *s)
int16_t(* block)[64]
points to one of the following blocks
ParseContext parse_context
VLC_TYPE(* table)[2]
code, bits
static int h261_decode_mb_skipped(H261Context *h, int mba1, int mba2)
Decode skipped macroblocks.
int key_frame
1 -> keyframe, 0-> not
static const uint8_t * align_get_bits(GetBitContext *s)
int frame_number
Frame counter, set by libavcodec.
int flags
AVCodecContext.flags (HQ, MV4, ...)
static int decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int ff_find_unused_picture(MpegEncContext *s, int shared)
#define AV_EF_COMPLIANT
consider all spec non compliancies as errors
This structure stores compressed data.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
void ff_MPV_decode_defaults(MpegEncContext *s)
Set the given MpegEncContext to defaults for decoding.
#define check(x, y, S, v)