h264_cabac.c File Reference

H.264 / AVC / MPEG4 part10 cabac decoding. More...

#include "config.h"
#include "cabac.h"
#include "cabac_functions.h"
#include "internal.h"
#include "avcodec.h"
#include "h264.h"
#include "h264data.h"
#include "h264_mvpred.h"
#include "golomb.h"
#include "libavutil/avassert.h"
Include dependency graph for h264_cabac.c:

Go to the source code of this file.

Macros

#define CABAC(h)   1
 
#define UNCHECKED_BITSTREAM_READER   1
 
#define DECODE_CABAC_MB_MVD(h, list, n)
 
#define CABAC_ON_STACK
 
#define CC   &cc
 
#define DECODE_SIGNIFICANCE(coefs, sig_off, last_off)
 
#define STORE_BLOCK(type)
 

Functions

void ff_h264_init_cabac_states (H264Context *h)
 
static int decode_cabac_field_decoding_flag (H264Context *h)
 
static int decode_cabac_intra_mb_type (H264Context *h, int ctx_base, int intra_slice)
 
static int decode_cabac_mb_skip (H264Context *h, int mb_x, int mb_y)
 
static int decode_cabac_mb_intra4x4_pred_mode (H264Context *h, int pred_mode)
 
static int decode_cabac_mb_chroma_pre_mode (H264Context *h)
 
static int decode_cabac_mb_cbp_luma (H264Context *h)
 
static int decode_cabac_mb_cbp_chroma (H264Context *h)
 
static int decode_cabac_p_mb_sub_type (H264Context *h)
 
static int decode_cabac_b_mb_sub_type (H264Context *h)
 
static int decode_cabac_mb_ref (H264Context *h, int list, int n)
 
static int decode_cabac_mb_mvd (H264Context *h, int ctxbase, int amvd, int *mvda)
 
static av_always_inline int get_cabac_cbf_ctx (H264Context *h, int cat, int idx, int max_coeff, int is_dc)
 
static av_always_inline void decode_cabac_residual_internal (H264Context *h, int16_t *block, int cat, int n, const uint8_t *scantable, const uint32_t *qmul, int max_coeff, int is_dc, int chroma422)
 
static void decode_cabac_residual_dc_internal (H264Context *h, int16_t *block, int cat, int n, const uint8_t *scantable, int max_coeff)
 
static void decode_cabac_residual_dc_internal_422 (H264Context *h, int16_t *block, int cat, int n, const uint8_t *scantable, int max_coeff)
 
static void decode_cabac_residual_nondc_internal (H264Context *h, int16_t *block, int cat, int n, const uint8_t *scantable, const uint32_t *qmul, int max_coeff)
 
static av_always_inline void decode_cabac_residual_dc (H264Context *h, int16_t *block, int cat, int n, const uint8_t *scantable, int max_coeff)
 
static av_always_inline void decode_cabac_residual_dc_422 (H264Context *h, int16_t *block, int cat, int n, const uint8_t *scantable, int max_coeff)
 
static av_always_inline void decode_cabac_residual_nondc (H264Context *h, int16_t *block, int cat, int n, const uint8_t *scantable, const uint32_t *qmul, int max_coeff)
 
static av_always_inline void decode_cabac_luma_residual (H264Context *h, const uint8_t *scan, const uint8_t *scan8x8, int pixel_shift, int mb_type, int cbp, int p)
 
int ff_h264_decode_mb_cabac (H264Context *h)
 Decode a macroblock. More...
 

Variables

static const int8_t cabac_context_init_I [1024][2]
 
static const int8_t cabac_context_init_PB [3][1024][2]
 

Detailed Description

H.264 / AVC / MPEG4 part10 cabac decoding.

Author
Michael Niedermayer micha.nosp@m.elni.nosp@m.@gmx..nosp@m.at

Definition in file h264_cabac.c.

Macro Definition Documentation

#define CABAC (   h)    1

Definition at line 28 of file h264_cabac.c.

Referenced by ff_h264_decode_mb_cabac().

#define CABAC_ON_STACK
#define CC   &cc
#define DECODE_CABAC_MB_MVD (   h,
  list,
  n 
)
Value:
{\
int amvd0 = h->mvd_cache[list][scan8[n] - 1][0] +\
h->mvd_cache[list][scan8[n] - 8][0];\
int amvd1 = h->mvd_cache[list][scan8[n] - 1][1] +\
h->mvd_cache[list][scan8[n] - 8][1];\
\
mx += decode_cabac_mb_mvd( h, 40, amvd0, &mpx );\
my += decode_cabac_mb_mvd( h, 47, amvd1, &mpy );\
}
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFilterBuffer structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining list
static const uint8_t scan8[16 *3+3]
Definition: h264.h:812
static int decode_cabac_mb_mvd(H264Context *h, int ctxbase, int amvd, int *mvda)
Definition: h264_cabac.c:1482

Definition at line 1518 of file h264_cabac.c.

Referenced by ff_h264_decode_mb_cabac().

#define DECODE_SIGNIFICANCE (   coefs,
  sig_off,
  last_off 
)
Value:
for(last= 0; last < coefs; last++) { \
uint8_t *sig_ctx = significant_coeff_ctx_base + sig_off; \
if( get_cabac( CC, sig_ctx )) { \
uint8_t *last_ctx = last_coeff_ctx_base + last_off; \
index[coeff_count++] = last; \
if( get_cabac( CC, last_ctx ) ) { \
last= max_coeff; \
break; \
} \
} \
}\
if( last == max_coeff -1 ) {\
index[coeff_count++] = last;\
}
static int av_unused get_cabac(CABACContext *c, uint8_t *const state)
initialize output if(nPeaks >3)%at least 3 peaks in spectrum for trying to find f0 nf0peaks
uint8_t
int index
Definition: gxfenc.c:89
#define CC

Referenced by decode_cabac_residual_internal().

#define STORE_BLOCK (   type)
#define UNCHECKED_BITSTREAM_READER   1

Definition at line 29 of file h264_cabac.c.

Function Documentation

static int decode_cabac_b_mb_sub_type ( H264Context h)
static

Definition at line 1437 of file h264_cabac.c.

Referenced by ff_h264_decode_mb_cabac().

static int decode_cabac_field_decoding_flag ( H264Context h)
static

Definition at line 1280 of file h264_cabac.c.

Referenced by ff_h264_decode_mb_cabac().

static int decode_cabac_intra_mb_type ( H264Context h,
int  ctx_base,
int  intra_slice 
)
static

Definition at line 1291 of file h264_cabac.c.

Referenced by ff_h264_decode_mb_cabac().

static av_always_inline void decode_cabac_luma_residual ( H264Context h,
const uint8_t scan,
const uint8_t scan8x8,
int  pixel_shift,
int  mb_type,
int  cbp,
int  p 
)
static

Definition at line 1825 of file h264_cabac.c.

Referenced by ff_h264_decode_mb_cabac().

static int decode_cabac_mb_cbp_chroma ( H264Context h)
static

Definition at line 1409 of file h264_cabac.c.

Referenced by ff_h264_decode_mb_cabac().

static int decode_cabac_mb_cbp_luma ( H264Context h)
static

Definition at line 1393 of file h264_cabac.c.

Referenced by ff_h264_decode_mb_cabac().

static int decode_cabac_mb_chroma_pre_mode ( H264Context h)
static

Definition at line 1369 of file h264_cabac.c.

Referenced by ff_h264_decode_mb_cabac().

static int decode_cabac_mb_intra4x4_pred_mode ( H264Context h,
int  pred_mode 
)
static

Definition at line 1356 of file h264_cabac.c.

Referenced by ff_h264_decode_mb_cabac().

static int decode_cabac_mb_mvd ( H264Context h,
int  ctxbase,
int  amvd,
int *  mvda 
)
static

Definition at line 1482 of file h264_cabac.c.

static int decode_cabac_mb_ref ( H264Context h,
int  list,
int  n 
)
static

Definition at line 1454 of file h264_cabac.c.

Referenced by ff_h264_decode_mb_cabac().

static int decode_cabac_mb_skip ( H264Context h,
int  mb_x,
int  mb_y 
)
static

Definition at line 1321 of file h264_cabac.c.

Referenced by ff_h264_decode_mb_cabac().

static int decode_cabac_p_mb_sub_type ( H264Context h)
static

Definition at line 1428 of file h264_cabac.c.

Referenced by ff_h264_decode_mb_cabac().

static av_always_inline void decode_cabac_residual_dc ( H264Context h,
int16_t *  block,
int  cat,
int  n,
const uint8_t scantable,
int  max_coeff 
)
static

Definition at line 1779 of file h264_cabac.c.

Referenced by decode_cabac_luma_residual(), and ff_h264_decode_mb_cabac().

static av_always_inline void decode_cabac_residual_dc_422 ( H264Context h,
int16_t *  block,
int  cat,
int  n,
const uint8_t scantable,
int  max_coeff 
)
static

Definition at line 1794 of file h264_cabac.c.

Referenced by ff_h264_decode_mb_cabac().

static void decode_cabac_residual_dc_internal ( H264Context h,
int16_t *  block,
int  cat,
int  n,
const uint8_t scantable,
int  max_coeff 
)
static

Definition at line 1743 of file h264_cabac.c.

Referenced by decode_cabac_residual_dc().

static void decode_cabac_residual_dc_internal_422 ( H264Context h,
int16_t *  block,
int  cat,
int  n,
const uint8_t scantable,
int  max_coeff 
)
static

Definition at line 1751 of file h264_cabac.c.

Referenced by decode_cabac_residual_dc_422().

static av_always_inline void decode_cabac_residual_internal ( H264Context h,
int16_t *  block,
int  cat,
int  n,
const uint8_t scantable,
const uint32_t *  qmul,
int  max_coeff,
int  is_dc,
int  chroma422 
)
static
static av_always_inline void decode_cabac_residual_nondc ( H264Context h,
int16_t *  block,
int  cat,
int  n,
const uint8_t scantable,
const uint32_t *  qmul,
int  max_coeff 
)
static

Definition at line 1806 of file h264_cabac.c.

Referenced by decode_cabac_luma_residual(), and ff_h264_decode_mb_cabac().

static void decode_cabac_residual_nondc_internal ( H264Context h,
int16_t *  block,
int  cat,
int  n,
const uint8_t scantable,
const uint32_t *  qmul,
int  max_coeff 
)
static

Definition at line 1758 of file h264_cabac.c.

Referenced by decode_cabac_residual_nondc().

int ff_h264_decode_mb_cabac ( H264Context h)

Decode a macroblock.

Decode a CABAC coded macroblock.

Returns
0 if OK, ER_AC_ERROR / ER_DC_ERROR / ER_MV_ERROR if an error is noticed

Definition at line 1875 of file h264_cabac.c.

Referenced by decode_slice().

void ff_h264_init_cabac_states ( H264Context h)

Definition at line 1260 of file h264_cabac.c.

Referenced by decode_slice().

static av_always_inline int get_cabac_cbf_ctx ( H264Context h,
int  cat,
int  idx,
int  max_coeff,
int  is_dc 
)
static

Variable Documentation

const int8_t cabac_context_init_I[1024][2]
static

Definition at line 48 of file h264_cabac.c.

Referenced by ff_h264_init_cabac_states().

const int8_t cabac_context_init_PB[3][1024][2]
static

Definition at line 360 of file h264_cabac.c.

Referenced by ff_h264_init_cabac_states().