36 #define H261_MBA_VLC_BITS 9
37 #define H261_MTYPE_VLC_BITS 6
38 #define H261_MV_VLC_BITS 7
39 #define H261_CBP_VLC_BITS 9
40 #define TCOEFF_VLC_BITS 9
41 #define MBA_STUFFING 33
42 #define MBA_STARTCODE 34
173 for (; left > 15 + 1 + 4 + 5; left -= 8) {
201 for (i = mba1; i < mba2; i++) {
210 for (j = 0; j < 6; j++)
228 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -16
239 mv_diff =
mvmap[mv_diff];
275 if ((level & 0x7F) == 0) {
295 block[0] = (check & 0x1) ? -1 : 1;
319 }
else if (code == 0) {
438 for (i = 0; i < 6; i++) {
444 for (i = 0; i < 6; i++)
461 uint32_t startcode = 0;
464 startcode = ((startcode << 1) |
get_bits(&s->
gb, 1)) & 0x000FFFFF;
466 if (startcode == 0x10)
470 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]);
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
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
int ff_set_dimensions(AVCodecContext *s, int width, int height)
Check that the provided frame dimensions are valid and set them on the codec context.
const uint8_t ff_h261_mba_bits[35]
void ff_print_debug_info(MpegEncContext *s, Picture *p)
Print debugging info for the given picture.
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
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
#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)
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
const char * name
Name of the codec implementation.
void ff_mpv_decode_mb(MpegEncContext *s, int16_t block[12][64])
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.
av_cold void ff_mpv_idct_init(MpegEncContext *s)
int mb_height
number of MBs horizontally & vertically
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.
void(* clear_blocks)(int16_t *blocks)
#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
void ff_mpv_common_end(MpegEncContext *s)
#define INIT_VLC_RL(rl, static_size)
Libavcodec external API header.
int n
number of entries of table_vlc minus 1
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]
Picture * current_picture_ptr
pointer to the current picture
void ff_mpeg_er_frame_start(MpegEncContext *s)
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
#define FF_ARRAY_ELEMS(a)
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]
static int h261_decode_gob_header(H261Context *h)
Decode the group of blocks header or slice header.
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
void ff_mpv_decode_defaults(MpegEncContext *s)
Set the given MpegEncContext to defaults for decoding.
const uint8_t ff_h261_mv_tab[17][2]
#define MV_TYPE_16X16
1 vector for the whole mb
const int ff_h261_mtype_map[10]
main external API structure.
static void close(AVCodecParserContext *s)
ScanTable intra_scantable
int height
picture size. must be a multiple of 16
#define SLICE_END
end marker found
static int h261_decode_gob(H261Context *h)
static unsigned int get_bits1(GetBitContext *s)
static void skip_bits1(GetBitContext *s)
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.
#define H261_MTYPE_VLC_BITS
int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx)
generic function called after decoding the header and before a frame is decoded.
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
common internal api header.
int mb_stride
mb_width+1 used for some arrays to allow simple addressing of left & top MBs without sig11 ...
const struct AVCodec * codec
static av_cold int init(AVCodecParserContext *s)
static int h261_decode_mb(H261Context *h)
av_cold int ff_mpv_common_init(MpegEncContext *s)
init common structure for both encoder and decoder.
static int decode_mv_component(GetBitContext *gb, int v)
void ff_mpv_frame_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, ...)
uint32_t * mb_type
types and macros are defined in mpegutils.h
This structure stores compressed data.
#define check(x, y, S, v)