FFmpeg
Loading...
Searching...
No Matches
h261enc.c File Reference

H.261 encoder. More...

#include "libavutil/attributes.h"
#include "libavutil/avassert.h"
#include "libavutil/thread.h"
#include "avcodec.h"
#include "codec_internal.h"
#include "mpegutils.h"
#include "mpegvideo.h"
#include "h261.h"
#include "h261enc.h"
#include "mpegvideoenc.h"
#include "put_bits.h"

Go to the source code of this file.

Data Structures

struct  VLCLUT
 
struct  H261EncContext
 

Macros

#define H261_MAX_RUN   26
 
#define H261_MAX_LEVEL   15
 
#define H261_ESC_LEN   (6 + 6 + 8)
 
#define MV_TAB_OFFSET   32
 

Functions

static int h261_encode_picture_header (MPVMainEncContext *const m)
 
static void h261_encode_gob_header (MPVEncContext *const s, int mb_line)
 Encode a group of blocks header.
 
void ff_h261_reorder_mb_index (MPVEncContext *const s)
 
static void h261_encode_motion (PutBitContext *pb, int val)
 
static int get_cbp (const int block_last_index[6])
 
static void h261_encode_block (H261EncContext *h, int16_t *block, int n)
 Encode an 8x8 block.
 
static void h261_encode_mb (MPVEncContext *const s, int16_t block[6][64], int motion_x, int motion_y)
 
static av_cold void h261_encode_init_static (void)
 
static av_cold int h261_encode_init (AVCodecContext *avctx)
 

Variables

static struct VLCLUT vlc_lut [H261_MAX_RUN+1][32/*0..2 *H261_MAX_LEN are used */]
 
static uint8_t mv_penalty [MAX_FCODE+1][MAX_DMV *2+1]
 
static uint8_t uni_h261_rl_len [64 *128]
 
static uint8_t uni_h261_rl_len_last [64 *128]
 
static uint8_t h261_mv_codes [64][2]
 
const FFCodec ff_h261_encoder
 

Detailed Description

H.261 encoder.

Definition in file h261enc.c.

Macro Definition Documentation

◆ H261_MAX_RUN

#define H261_MAX_RUN   26

Definition at line 40 of file h261enc.c.

Referenced by h261_encode_block().

◆ H261_MAX_LEVEL

#define H261_MAX_LEVEL   15

Definition at line 41 of file h261enc.c.

Referenced by h261_encode_block(), and h261_encode_init_static().

◆ H261_ESC_LEN

#define H261_ESC_LEN   (6 + 6 + 8)

Definition at line 42 of file h261enc.c.

Referenced by h261_encode_init(), and h261_encode_init_static().

◆ MV_TAB_OFFSET

#define MV_TAB_OFFSET   32

Definition at line 43 of file h261enc.c.

Referenced by h261_encode_init_static(), and h261_encode_motion().

Function Documentation

◆ h261_encode_picture_header()

static int h261_encode_picture_header ( MPVMainEncContext *const m)
static

Definition at line 68 of file h261enc.c.

Referenced by h261_encode_init().

◆ h261_encode_gob_header()

static void h261_encode_gob_header ( MPVEncContext *const s,
int mb_line )
static

Encode a group of blocks header.

Definition at line 101 of file h261enc.c.

Referenced by ff_h261_reorder_mb_index().

◆ ff_h261_reorder_mb_index()

void ff_h261_reorder_mb_index ( MPVEncContext *const s)

Definition at line 118 of file h261enc.c.

Referenced by encode_thread().

◆ h261_encode_motion()

static void h261_encode_motion ( PutBitContext * pb,
int val )
static

Definition at line 146 of file h261enc.c.

Referenced by h261_encode_mb().

◆ get_cbp()

static int get_cbp ( const int block_last_index[6])
inlinestatic

Definition at line 152 of file h261enc.c.

Referenced by h261_encode_mb().

◆ h261_encode_block()

static void h261_encode_block ( H261EncContext * h,
int16_t * block,
int n )
static

Encode an 8x8 block.

Parameters
blockthe 8x8 block
nblock index (0-3 are luma, 4-5 are chroma)

Definition at line 167 of file h261enc.c.

Referenced by h261_encode_mb().

◆ h261_encode_mb()

static void h261_encode_mb ( MPVEncContext *const s,
int16_t block[6][64],
int motion_x,
int motion_y )
static

Definition at line 227 of file h261enc.c.

Referenced by h261_encode_init().

◆ h261_encode_init_static()

static av_cold void h261_encode_init_static ( void )
static

Definition at line 316 of file h261enc.c.

Referenced by h261_encode_init().

◆ h261_encode_init()

static av_cold int h261_encode_init ( AVCodecContext * avctx)
static

Definition at line 353 of file h261enc.c.

Variable Documentation

◆ vlc_lut

struct VLCLUT vlc_lut[H261_MAX_RUN + 1][32 /* 0..2 * H261_MAX_LEN are used */]
static

◆ mv_penalty

◆ uni_h261_rl_len

uint8_t uni_h261_rl_len[64 *128]
static

Definition at line 54 of file h261enc.c.

Referenced by h261_encode_init(), and h261_encode_init_static().

◆ uni_h261_rl_len_last

uint8_t uni_h261_rl_len_last[64 *128]
static

Definition at line 55 of file h261enc.c.

Referenced by h261_encode_init(), and h261_encode_init_static().

◆ h261_mv_codes

uint8_t h261_mv_codes[64][2]
static

Definition at line 56 of file h261enc.c.

Referenced by h261_encode_init_static(), and h261_encode_motion().

◆ ff_h261_encoder

const FFCodec ff_h261_encoder
Initial value:
= {
.p.name = "h261",
CODEC_LONG_NAME("H.261"),
.p.type = AVMEDIA_TYPE_VIDEO,
.p.priv_class = &ff_mpv_enc_class,
.priv_data_size = sizeof(H261EncContext),
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.color_ranges = AVCOL_RANGE_MPEG,
}
#define CODEC_PIXFMTS(...)
#define FF_CODEC_ENCODE_CB(func)
#define CODEC_LONG_NAME(str)
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
This encoder can reorder user opaque values from input AVFrames and return them with corresponding ou...
Definition codec.h:147
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition codec.h:49
@ AV_CODEC_ID_H261
Definition codec_id.h:53
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
static av_cold int h261_encode_init(AVCodecContext *avctx)
Definition h261enc.c:353
const AVClass ff_mpv_enc_class
int ff_mpv_encode_picture(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pic_arg, int *got_packet)
av_cold int ff_mpv_encode_end(AVCodecContext *avctx)
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
Definition pixfmt.h:766
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition pixfmt.h:73

Definition at line 386 of file h261enc.c.