37 #define H261_MBA_VLC_BITS 9
38 #define H261_MTYPE_VLC_BITS 6
39 #define H261_MV_VLC_BITS 7
40 #define H261_CBP_VLC_BITS 9
41 #define TCOEFF_VLC_BITS 9
42 #define MBA_STUFFING 33
43 #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++)
221 int b_xy = 2 * s->
mb_x + (2 * s->
mb_y) * b_stride;
233 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -16
244 mv_diff =
mvmap[mv_diff];
280 if ((level & 0x7F) == 0) {
300 block[0] = (check & 0x1) ? -1 : 1;
331 }
else if (level == 0) {
450 int b_xy = 2 * s->
mb_x + (2 * s->
mb_y) * b_stride;
459 for (i = 0; i < 6; i++) {
465 for (i = 0; i < 6; i++)
482 uint32_t startcode = 0;
485 startcode = ((startcode << 1) |
get_bits(&s->
gb, 1)) & 0x000FFFFF;
487 if (startcode == 0x10)
491 if (startcode != 0x10) {
579 if (pos + 10 > buf_size)
589 int buf_size = avpkt->
size;
596 ff_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 AVERROR_INVALIDDATA
Invalid data found when processing input.
#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
ptrdiff_t const GLvoid * data
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.
static av_cold int init(AVCodecContext *avctx)
#define INIT_VLC_STATIC(vlc, bits, a, b, c, d, e, f, g, static_size)
#define SKIP_COUNTER(name, gb, num)
const uint8_t ff_h261_mba_bits[35]
#define AV_EF_COMPLIANT
consider all spec non compliances as errors
void(* clear_blocks)(int16_t *blocks)
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
#define AV_EF_BITSTREAM
detect bitstream specification deviations
int mb_num
number of MBs of a picture
const uint8_t ff_h261_mba_code[35]
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.
enum AVDiscard skip_frame
Skip decoding for selected frames.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
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.
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
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.
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 UPDATE_CACHE(name, 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. ...
simple assert() macros that are a bit more flexible than ISO C assert().
const char * name
Name of the codec implementation.
int low_delay
no reordering needed / has no B-frames
#define CLOSE_READER(name, gb)
void ff_mpv_common_end(MpegEncContext *s)
#define INIT_VLC_RL(rl, static_size)
#define GET_RL_VLC(level, run, name, gb, table, bits,max_depth, need_update)
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]
int16_t(*[2] motion_val)[2]
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.
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.
RL_VLC_ELEM * rl_vlc[32]
decoding only
#define SHOW_UBITS(name, gb, num)
#define FF_ARRAY_ELEMS(a)
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]
Libavcodec external API header.
main external API structure.
ScanTable intra_scantable
int height
picture size. must be a multiple of 16
#define OPEN_READER(name, gb)
void ff_print_debug_info(MpegEncContext *s, Picture *p, AVFrame *pict)
#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 const char * format
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.
#define SKIP_CACHE(name, gb, num)
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
static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avpkt)
#define SHOW_SBITS(name, gb, num)
discard all non reference
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 ...
void ff_mpv_decode_init(MpegEncContext *s, AVCodecContext *avctx)
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.
uint32_t * mb_type
types and macros are defined in mpegutils.h
static int skip_1stop_8data_bits(GetBitContext *gb)
This structure stores compressed data.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
#define check(x, y, S, v)