FFmpeg
Macros | Functions | Variables
ituh263enc.c File Reference
#include <limits.h>
#include "libavutil/attributes.h"
#include "avcodec.h"
#include "mpegvideo.h"
#include "mpegvideodata.h"
#include "h263.h"
#include "h263data.h"
#include "mathops.h"
#include "mpegutils.h"
#include "flv.h"
#include "mpeg4video.h"
#include "internal.h"

Go to the source code of this file.

Macros

#define UNI_MPEG4_ENC_INDEX(last, run, level)   ((last)*128*64 + (run)*128 + (level))
 

Functions

av_const int ff_h263_aspect_to_info (AVRational aspect)
 Return the 4 bit value that specifies the given aspect ratio. More...
 
void ff_h263_encode_picture_header (MpegEncContext *s, int picture_number)
 
void ff_h263_encode_gob_header (MpegEncContext *s, int mb_line)
 Encode a group of blocks header. More...
 
void ff_clean_h263_qscales (MpegEncContext *s)
 modify qscale so that encoding is actually possible in H.263 (limit difference to -2..2) More...
 
static void h263_encode_block (MpegEncContext *s, int16_t *block, int n)
 Encode an 8x8 block. More...
 
static void h263p_encode_umotion (PutBitContext *pb, int val)
 
void ff_h263_encode_mb (MpegEncContext *s, int16_t block[6][64], int motion_x, int motion_y)
 
void ff_h263_encode_motion (PutBitContext *pb, int val, int f_code)
 
static av_cold void init_mv_penalty_and_fcode (MpegEncContext *s)
 
static av_cold void init_uni_h263_rl_tab (RLTable *rl, uint32_t *bits_tab, uint8_t *len_tab)
 
av_cold void ff_h263_encode_init (MpegEncContext *s)
 
void ff_h263_encode_mba (MpegEncContext *s)
 

Variables

static uint8_t mv_penalty [MAX_FCODE+1][MAX_DMV *2+1]
 Table of number of bits a motion vector component needs. More...
 
static uint8_t fcode_tab [MAX_MV *2+1]
 Minimal fcode that a motion vector component would need. More...
 
static uint8_t umv_fcode_tab [MAX_MV *2+1]
 Minimal fcode that a motion vector component would need in umv. More...
 
static uint8_t uni_h263_intra_aic_rl_len [64 *64 *2 *2]
 
static uint8_t uni_h263_inter_rl_len [64 *64 *2 *2]
 
static const uint8_t wrong_run [102]
 
static const int dquant_code [5] = {1,0,9,2,3}
 

Detailed Description

H.263 bitstream encoder.

Definition in file ituh263enc.c.

Macro Definition Documentation

◆ UNI_MPEG4_ENC_INDEX

#define UNI_MPEG4_ENC_INDEX (   last,
  run,
  level 
)    ((last)*128*64 + (run)*128 + (level))

Definition at line 66 of file ituh263enc.c.

Function Documentation

◆ ff_h263_aspect_to_info()

av_const int ff_h263_aspect_to_info ( AVRational  aspect)

Return the 4 bit value that specifies the given aspect ratio.

This may be one of the standard aspect ratios or it specifies that the aspect will be stored explicitly later.

Definition at line 89 of file ituh263enc.c.

Referenced by ff_h263_encode_picture_header(), and mpeg4_encode_vol_header().

◆ ff_h263_encode_picture_header()

void ff_h263_encode_picture_header ( MpegEncContext s,
int  picture_number 
)

Definition at line 103 of file ituh263enc.c.

Referenced by encode_picture().

◆ ff_h263_encode_gob_header()

void ff_h263_encode_gob_header ( MpegEncContext s,
int  mb_line 
)

Encode a group of blocks header.

Definition at line 240 of file ituh263enc.c.

Referenced by encode_thread().

◆ ff_clean_h263_qscales()

void ff_clean_h263_qscales ( MpegEncContext s)

modify qscale so that encoding is actually possible in H.263 (limit difference to -2..2)

Definition at line 266 of file ituh263enc.c.

Referenced by estimate_qp(), and ff_clean_mpeg4_qscales().

◆ h263_encode_block()

static void h263_encode_block ( MpegEncContext s,
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 299 of file ituh263enc.c.

Referenced by ff_h263_encode_mb().

◆ h263p_encode_umotion()

static void h263p_encode_umotion ( PutBitContext pb,
int  val 
)
static

Definition at line 410 of file ituh263enc.c.

Referenced by ff_h263_encode_mb().

◆ ff_h263_encode_mb()

void ff_h263_encode_mb ( MpegEncContext s,
int16_t  block[6][64],
int  motion_x,
int  motion_y 
)

Definition at line 447 of file ituh263enc.c.

Referenced by encode_mb_internal().

◆ ff_h263_encode_motion()

void ff_h263_encode_motion ( PutBitContext pb,
int  val,
int  f_code 
)

Definition at line 646 of file ituh263enc.c.

Referenced by ff_h263_encode_motion_vector(), and svq1_encode_plane().

◆ init_mv_penalty_and_fcode()

static av_cold void init_mv_penalty_and_fcode ( MpegEncContext s)
static

Definition at line 674 of file ituh263enc.c.

Referenced by ff_h263_encode_init().

◆ init_uni_h263_rl_tab()

static av_cold void init_uni_h263_rl_tab ( RLTable rl,
uint32_t *  bits_tab,
uint8_t len_tab 
)
static

Definition at line 716 of file ituh263enc.c.

Referenced by ff_h263_encode_init().

◆ ff_h263_encode_init()

av_cold void ff_h263_encode_init ( MpegEncContext s)

Definition at line 761 of file ituh263enc.c.

Referenced by encode_init(), ff_mpv_encode_init(), and svq1_encode_init().

◆ ff_h263_encode_mba()

void ff_h263_encode_mba ( MpegEncContext s)

Variable Documentation

◆ mv_penalty

uint8_t mv_penalty[MAX_FCODE+1][MAX_DMV *2+1]
static

◆ fcode_tab

uint8_t fcode_tab[MAX_MV *2+1]
static

Minimal fcode that a motion vector component would need.

Definition at line 52 of file ituh263enc.c.

Referenced by ff_get_best_fcode(), ff_h263_encode_init(), and init_mv_penalty_and_fcode().

◆ umv_fcode_tab

uint8_t umv_fcode_tab[MAX_MV *2+1]
static

Minimal fcode that a motion vector component would need in umv.

All entries in this table are 1.

Definition at line 58 of file ituh263enc.c.

Referenced by ff_h263_encode_init(), and init_mv_penalty_and_fcode().

◆ uni_h263_intra_aic_rl_len

uint8_t uni_h263_intra_aic_rl_len[64 *64 *2 *2]
static

Definition at line 62 of file ituh263enc.c.

Referenced by ff_h263_encode_init().

◆ uni_h263_inter_rl_len

uint8_t uni_h263_inter_rl_len[64 *64 *2 *2]
static

Definition at line 63 of file ituh263enc.c.

Referenced by ff_h263_encode_init().

◆ wrong_run

const uint8_t wrong_run[102]
static
Initial value:
= {
1, 2, 3, 5, 4, 10, 9, 8,
11, 15, 17, 16, 23, 22, 21, 20,
19, 18, 25, 24, 27, 26, 11, 7,
6, 1, 2, 13, 2, 2, 2, 2,
6, 12, 3, 9, 1, 3, 4, 3,
7, 4, 1, 1, 5, 5, 14, 6,
1, 7, 1, 8, 1, 1, 1, 1,
10, 1, 1, 5, 9, 17, 25, 24,
29, 33, 32, 41, 2, 23, 28, 31,
3, 22, 30, 4, 27, 40, 8, 26,
6, 39, 7, 38, 16, 37, 15, 10,
11, 12, 13, 14, 1, 21, 20, 18,
19, 2, 1, 34, 35, 36
}

Definition at line 68 of file ituh263enc.c.

Referenced by h263_encode_block().

◆ dquant_code

const int dquant_code[5] = {1,0,9,2,3}
static

Definition at line 292 of file ituh263enc.c.

Referenced by ff_h263_encode_mb().