#include "internal.h"
#include "dsputil.h"
#include "avcodec.h"
#include "mpegvideo.h"
#include "h264.h"
#include "h264data.h"
#include "h264_mvpred.h"
#include "h264_parser.h"
#include "golomb.h"
#include "mathops.h"
#include "rectangle.h"
#include "vdpau_internal.h"
#include "cabac.h"
#include <assert.h>
Go to the source code of this file.
Defines | |
#define | RS 0 |
#define | stride 16 |
#define | XCHG(a, b, xchg) |
#define | T(x) (x>>2) | ((x<<2) & 0xF) |
#define | T(x) (x>>3) | ((x&7)<<3) |
Functions | |
void | ff_h264_write_back_intra_pred_mode (H264Context *h) |
int | ff_h264_check_intra4x4_pred_mode (H264Context *h) |
checks if the top & left blocks are available if needed & changes the dc mode so it only uses the available blocks. | |
int | ff_h264_check_intra_pred_mode (H264Context *h, int mode) |
checks if the top & left blocks are available if needed & changes the dc mode so it only uses the available blocks. | |
const uint8_t * | ff_h264_decode_nal (H264Context *h, const uint8_t *src, int *dst_length, int *consumed, int length) |
Decodes a network abstraction layer unit. | |
int | ff_h264_decode_rbsp_trailing (H264Context *h, const uint8_t *src) |
identifies the exact end of the bitstream | |
static void | h264_luma_dc_dequant_idct_c (DCTELEM *block, int qp, int qmul) |
IDCT transforms the 16 dc values and dequantizes them. | |
static void | chroma_dc_dequant_idct_c (DCTELEM *block, int qp, int qmul) |
static void | mc_dir_part (H264Context *h, Picture *pic, int n, int square, int chroma_height, int delta, int list, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int src_x_offset, int src_y_offset, qpel_mc_func *qpix_op, h264_chroma_mc_func chroma_op) |
static void | mc_part_std (H264Context *h, int n, int square, int chroma_height, int delta, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int x_offset, int y_offset, qpel_mc_func *qpix_put, h264_chroma_mc_func chroma_put, qpel_mc_func *qpix_avg, h264_chroma_mc_func chroma_avg, int list0, int list1) |
static void | mc_part_weighted (H264Context *h, int n, int square, int chroma_height, int delta, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int x_offset, int y_offset, qpel_mc_func *qpix_put, h264_chroma_mc_func chroma_put, h264_weight_func luma_weight_op, h264_weight_func chroma_weight_op, h264_biweight_func luma_weight_avg, h264_biweight_func chroma_weight_avg, int list0, int list1) |
static void | mc_part (H264Context *h, int n, int square, int chroma_height, int delta, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int x_offset, int y_offset, qpel_mc_func *qpix_put, h264_chroma_mc_func chroma_put, qpel_mc_func *qpix_avg, h264_chroma_mc_func chroma_avg, h264_weight_func *weight_op, h264_biweight_func *weight_avg, int list0, int list1) |
static void | prefetch_motion (H264Context *h, int list) |
static void | hl_motion (H264Context *h, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, qpel_mc_func(*qpix_put)[16], h264_chroma_mc_func(*chroma_put), qpel_mc_func(*qpix_avg)[16], h264_chroma_mc_func(*chroma_avg), h264_weight_func *weight_op, h264_biweight_func *weight_avg) |
static void | free_tables (H264Context *h) |
static void | init_dequant8_coeff_table (H264Context *h) |
static void | init_dequant4_coeff_table (H264Context *h) |
static void | init_dequant_tables (H264Context *h) |
int | ff_h264_alloc_tables (H264Context *h) |
allocates tables. | |
static void | clone_tables (H264Context *dst, H264Context *src, int i) |
Mimic alloc_tables(), but for every context thread. | |
static int | context_init (H264Context *h) |
Init context Allocate buffers which are not shared amongst multiple threads. | |
static int | decode_nal_units (H264Context *h, const uint8_t *buf, int buf_size) |
static av_cold void | common_init (H264Context *h) |
av_cold int | ff_h264_decode_init (AVCodecContext *avctx) |
int | ff_h264_frame_start (H264Context *h) |
static void | backup_mb_border (H264Context *h, uint8_t *src_y, uint8_t *src_cb, uint8_t *src_cr, int linesize, int uvlinesize, int simple) |
static void | xchg_mb_border (H264Context *h, uint8_t *src_y, uint8_t *src_cb, uint8_t *src_cr, int linesize, int uvlinesize, int xchg, int simple) |
static av_always_inline void | hl_decode_mb_internal (H264Context *h, int simple) |
static void | hl_decode_mb_simple (H264Context *h) |
Process a macroblock; this case avoids checks for expensive uncommon cases. | |
static void av_noinline | hl_decode_mb_complex (H264Context *h) |
Process a macroblock; this handles edge cases, such as interlacing. | |
void | ff_h264_hl_decode_mb (H264Context *h) |
static int | pred_weight_table (H264Context *h) |
static void | implicit_weight_table (H264Context *h, int field) |
Initialize implicit_weight table. | |
static void | idr (H264Context *h) |
instantaneous decoder refresh. | |
static void | flush_dpb (AVCodecContext *avctx) |
static int | init_poc (H264Context *h) |
static void | init_scan_tables (H264Context *h) |
initialize scan tables | |
static void | field_end (H264Context *h) |
static void | clone_slice (H264Context *dst, H264Context *src) |
Replicates H264 "master" context to thread contexts. | |
static int | decode_slice_header (H264Context *h, H264Context *h0) |
decodes a slice header. | |
int | ff_h264_get_slice_type (const H264Context *h) |
reconstructs bitstream slice_type. | |
static int | fill_filter_caches (H264Context *h, int mb_type) |
static void | loop_filter (H264Context *h) |
static void | predict_field_decoding_flag (H264Context *h) |
static int | decode_slice (struct AVCodecContext *avctx, void *arg) |
static void | execute_decode_slices (H264Context *h, int context_count) |
Call decode_slice() for each context. | |
static int | get_consumed_bytes (MpegEncContext *s, int pos, int buf_size) |
returns the number of bytes consumed for building the current frame | |
static int | decode_frame (AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) |
av_cold void | ff_h264_free_context (H264Context *h) |
frees any data that may have been allocated in the H264 context like SPS, PPS etc. | |
av_cold int | ff_h264_decode_end (AVCodecContext *avctx) |
Variables | |
static const uint8_t | rem6 [52] |
static const uint8_t | div6 [52] |
AVCodec | h264_decoder |
Definition in file h264.c.
#define RS 0 |
Referenced by ff_h264_decode_nal().
#define stride 16 |
Referenced by aasc_decode_frame(), apply_loop_filter(), avs_decode_frame(), bink_decode_plane(), bitplane_decoding(), cdg_scroll(), cdg_tile_block(), check_bidir_mv(), chroma_dc_dequant_idct_c(), cmp_direct_inline(), cmp_inline(), copy_picture_attributes(), decode(), decode_13(), decode_frame(), decode_i2_frame(), decode_i_frame(), decode_p_frame(), deInterlaceBlendLinear_TMPL(), deInterlaceFF_TMPL(), deInterlaceInterpolateCubic_TMPL(), deInterlaceInterpolateLinear_TMPL(), deInterlaceL5_TMPL(), deInterlaceMedian_TMPL(), dequant(), dering_TMPL(), do_a_deblock_TMPL(), doVertDefFilter_TMPL(), doVertLowPass_TMPL(), duplicate_TMPL(), encode_frame(), ff_apply_vector_2x2(), ff_apply_vector_4x4(), ff_h263_decode_mb(), ff_init_me(), ff_jpegls_decode_picture(), ff_svq3_luma_dc_dequant_idct_c(), get_frame_mb(), h263_mv4_search(), h264_luma_dc_dequant_idct_c(), hl_decode_mb_internal(), idct_put(), init_mv4_ref(), init_ref(), interlaced_search(), main(), mpeg4_decode_partition_a(), msvideo1_decode_16bit(), msvideo1_decode_8bit(), pcx_decode_frame(), pixels8(), postProcess_TMPL(), pp_get_context(), preview_obmc(), ptx_decode_frame(), read_table(), render_slice(), rpza_decode_stream(), sad_hpel_motion_search(), skip_check(), smc_decode_stream(), sunrast_decode_frame(), tempNoiseReducer_TMPL(), txd_decode_frame(), vertClassify_TMPL(), vertX1Filter_TMPL(), vp56_size_changed(), w_c(), xan_wc3_copy_pixel_run(), and xan_wc3_output_pixel_run().
#define T | ( | x | ) | (x>>3) | ((x&7)<<3) |
#define T | ( | x | ) | (x>>2) | ((x<<2) & 0xF) |
Referenced by get_context(), init_scan_tables(), predict(), wv_unpack_mono(), and x8_ac_compensation().
#define XCHG | ( | a, | |||
b, | |||||
xchg | ) |
static void backup_mb_border | ( | H264Context * | h, | |
uint8_t * | src_y, | |||
uint8_t * | src_cb, | |||
uint8_t * | src_cr, | |||
int | linesize, | |||
int | uvlinesize, | |||
int | simple | |||
) | [inline, static] |
static void chroma_dc_dequant_idct_c | ( | DCTELEM * | block, | |
int | qp, | |||
int | qmul | |||
) | [static] |
static void clone_slice | ( | H264Context * | dst, | |
H264Context * | src | |||
) | [static] |
Replicates H264 "master" context to thread contexts.
Definition at line 1679 of file h264.c.
Referenced by decode_slice_header().
static void clone_tables | ( | H264Context * | dst, | |
H264Context * | src, | |||
int | i | |||
) | [static] |
Mimic alloc_tables(), but for every context thread.
Definition at line 791 of file h264.c.
Referenced by decode_slice_header().
static av_cold void common_init | ( | H264Context * | h | ) | [static] |
static int context_init | ( | H264Context * | h | ) | [static] |
Init context Allocate buffers which are not shared amongst multiple threads.
Definition at line 813 of file h264.c.
Referenced by decode_slice_header().
static int decode_frame | ( | AVCodecContext * | avctx, | |
void * | data, | |||
int * | data_size, | |||
AVPacket * | avpkt | |||
) | [static] |
static int decode_nal_units | ( | H264Context * | h, | |
const uint8_t * | buf, | |||
int | buf_size | |||
) | [static] |
< thread context
Definition at line 2726 of file h264.c.
Referenced by decode_frame(), and ff_h264_decode_init().
static int decode_slice | ( | struct AVCodecContext * | avctx, | |
void * | arg | |||
) | [static] |
static int decode_slice_header | ( | H264Context * | h, | |
H264Context * | h0 | |||
) | [static] |
decodes a slice header.
This will also call MPV_common_init() and frame_start() as needed.
h | h264context | |
h0 | h264 master context (differs from 'h' when doing sliced based parallel decoding) |
static void execute_decode_slices | ( | H264Context * | h, | |
int | context_count | |||
) | [static] |
Call decode_slice() for each context.
h | h264 master context | |
context_count | number of contexts to execute |
Definition at line 2692 of file h264.c.
Referenced by decode_nal_units().
int ff_h264_alloc_tables | ( | H264Context * | h | ) |
allocates tables.
needs width/height
Definition at line 744 of file h264.c.
Referenced by decode_slice_header(), and svq3_decode_init().
int ff_h264_check_intra4x4_pred_mode | ( | H264Context * | h | ) |
checks if the top & left blocks are available if needed & changes the dc mode so it only uses the available blocks.
Definition at line 66 of file h264.c.
Referenced by ff_h264_decode_mb_cabac(), ff_h264_decode_mb_cavlc(), and svq3_decode_mb().
int ff_h264_check_intra_pred_mode | ( | H264Context * | h, | |
int | mode | |||
) |
checks if the top & left blocks are available if needed & changes the dc mode so it only uses the available blocks.
Definition at line 105 of file h264.c.
Referenced by ff_h264_decode_mb_cabac(), ff_h264_decode_mb_cavlc(), and svq3_decode_mb().
av_cold int ff_h264_decode_end | ( | AVCodecContext * | avctx | ) |
av_cold int ff_h264_decode_init | ( | AVCodecContext * | avctx | ) |
const uint8_t* ff_h264_decode_nal | ( | H264Context * | h, | |
const uint8_t * | src, | |||
int * | dst_length, | |||
int * | consumed, | |||
int | length | |||
) |
Decodes a network abstraction layer unit.
consumed | is the number of bytes used as input | |
length | is the length of the array | |
dst_length | is the number of decoded bytes FIXME here or a decode rbsp tailing? |
Definition at line 137 of file h264.c.
Referenced by decode_nal_units(), and parse_nal_units().
int ff_h264_decode_rbsp_trailing | ( | H264Context * | h, | |
const uint8_t * | src | |||
) |
identifies the exact end of the bitstream
Definition at line 227 of file h264.c.
Referenced by decode_nal_units().
int ff_h264_frame_start | ( | H264Context * | h | ) |
Definition at line 930 of file h264.c.
Referenced by decode_slice_header(), and svq3_decode_frame().
av_cold void ff_h264_free_context | ( | H264Context * | h | ) |
int ff_h264_get_slice_type | ( | const H264Context * | h | ) |
reconstructs bitstream slice_type.
Definition at line 2210 of file h264.c.
Referenced by decode_slice(), and fill_slice_long().
void ff_h264_hl_decode_mb | ( | H264Context * | h | ) |
Definition at line 1340 of file h264.c.
Referenced by decode_mb(), decode_slice(), and svq3_decode_frame().
void ff_h264_write_back_intra_pred_mode | ( | H264Context * | h | ) |
Definition at line 54 of file h264.c.
Referenced by ff_h264_decode_mb_cabac(), ff_h264_decode_mb_cavlc(), and svq3_decode_mb().
static void field_end | ( | H264Context * | h | ) | [static] |
static int fill_filter_caches | ( | H264Context * | h, | |
int | mb_type | |||
) | [static] |
Definition at line 2226 of file h264.c.
Referenced by loop_filter().
static void flush_dpb | ( | AVCodecContext * | avctx | ) | [static] |
static void free_tables | ( | H264Context * | h | ) | [static] |
Definition at line 648 of file h264.c.
Referenced by decode_slice_header(), ff_h264_alloc_tables(), and ff_h264_free_context().
static int get_consumed_bytes | ( | MpegEncContext * | s, | |
int | pos, | |||
int | buf_size | |||
) | [static] |
static void h264_luma_dc_dequant_idct_c | ( | DCTELEM * | block, | |
int | qp, | |||
int | qmul | |||
) | [static] |
IDCT transforms the 16 dc values and dequantizes them.
qp | quantization parameter |
Definition at line 244 of file h264.c.
Referenced by hl_decode_mb_internal().
static void av_noinline hl_decode_mb_complex | ( | H264Context * | h | ) | [static] |
Process a macroblock; this handles edge cases, such as interlacing.
Definition at line 1336 of file h264.c.
Referenced by ff_h264_hl_decode_mb().
static av_always_inline void hl_decode_mb_internal | ( | H264Context * | h, | |
int | simple | |||
) | [static] |
Definition at line 1081 of file h264.c.
Referenced by hl_decode_mb_complex(), and hl_decode_mb_simple().
static void hl_decode_mb_simple | ( | H264Context * | h | ) | [static] |
Process a macroblock; this case avoids checks for expensive uncommon cases.
Definition at line 1329 of file h264.c.
Referenced by ff_h264_hl_decode_mb().
static void hl_motion | ( | H264Context * | h, | |
uint8_t * | dest_y, | |||
uint8_t * | dest_cb, | |||
uint8_t * | dest_cr, | |||
qpel_mc_func(*) | qpix_put[16], | |||
h264_chroma_mc_func * | chroma_put, | |||
qpel_mc_func(*) | qpix_avg[16], | |||
h264_chroma_mc_func * | chroma_avg, | |||
h264_weight_func * | weight_op, | |||
h264_biweight_func * | weight_avg | |||
) | [static] |
static void idr | ( | H264Context * | h | ) | [static] |
instantaneous decoder refresh.
Definition at line 1476 of file h264.c.
Referenced by decode_nal_units(), and flush_dpb().
static void implicit_weight_table | ( | H264Context * | h, | |
int | field | |||
) | [static] |
Initialize implicit_weight table.
field,0/1 | initialize the weight for interlaced MBAFF -1 initializes the rest |
Definition at line 1416 of file h264.c.
Referenced by decode_slice_header().
static void init_dequant4_coeff_table | ( | H264Context * | h | ) | [static] |
static void init_dequant8_coeff_table | ( | H264Context * | h | ) | [static] |
static void init_dequant_tables | ( | H264Context * | h | ) | [static] |
Definition at line 727 of file h264.c.
Referenced by decode_slice_header(), and ff_h264_alloc_tables().
static int init_poc | ( | H264Context * | h | ) | [static] |
static void init_scan_tables | ( | H264Context * | h | ) | [static] |
static void loop_filter | ( | H264Context * | h | ) | [static] |
static void mc_dir_part | ( | H264Context * | h, | |
Picture * | pic, | |||
int | n, | |||
int | square, | |||
int | chroma_height, | |||
int | delta, | |||
int | list, | |||
uint8_t * | dest_y, | |||
uint8_t * | dest_cb, | |||
uint8_t * | dest_cr, | |||
int | src_x_offset, | |||
int | src_y_offset, | |||
qpel_mc_func * | qpix_op, | |||
h264_chroma_mc_func | chroma_op | |||
) | [inline, static] |
static void mc_part | ( | H264Context * | h, | |
int | n, | |||
int | square, | |||
int | chroma_height, | |||
int | delta, | |||
uint8_t * | dest_y, | |||
uint8_t * | dest_cb, | |||
uint8_t * | dest_cr, | |||
int | x_offset, | |||
int | y_offset, | |||
qpel_mc_func * | qpix_put, | |||
h264_chroma_mc_func | chroma_put, | |||
qpel_mc_func * | qpix_avg, | |||
h264_chroma_mc_func | chroma_avg, | |||
h264_weight_func * | weight_op, | |||
h264_biweight_func * | weight_avg, | |||
int | list0, | |||
int | list1 | |||
) | [inline, static] |
static void mc_part_std | ( | H264Context * | h, | |
int | n, | |||
int | square, | |||
int | chroma_height, | |||
int | delta, | |||
uint8_t * | dest_y, | |||
uint8_t * | dest_cb, | |||
uint8_t * | dest_cr, | |||
int | x_offset, | |||
int | y_offset, | |||
qpel_mc_func * | qpix_put, | |||
h264_chroma_mc_func | chroma_put, | |||
qpel_mc_func * | qpix_avg, | |||
h264_chroma_mc_func | chroma_avg, | |||
int | list0, | |||
int | list1 | |||
) | [inline, static] |
static void mc_part_weighted | ( | H264Context * | h, | |
int | n, | |||
int | square, | |||
int | chroma_height, | |||
int | delta, | |||
uint8_t * | dest_y, | |||
uint8_t * | dest_cb, | |||
uint8_t * | dest_cr, | |||
int | x_offset, | |||
int | y_offset, | |||
qpel_mc_func * | qpix_put, | |||
h264_chroma_mc_func | chroma_put, | |||
h264_weight_func | luma_weight_op, | |||
h264_weight_func | chroma_weight_op, | |||
h264_biweight_func | luma_weight_avg, | |||
h264_biweight_func | chroma_weight_avg, | |||
int | list0, | |||
int | list1 | |||
) | [inline, static] |
static int pred_weight_table | ( | H264Context * | h | ) | [static] |
static void predict_field_decoding_flag | ( | H264Context * | h | ) | [static] |
static void prefetch_motion | ( | H264Context * | h, | |
int | list | |||
) | [inline, static] |
static void xchg_mb_border | ( | H264Context * | h, | |
uint8_t * | src_y, | |||
uint8_t * | src_cb, | |||
uint8_t * | src_cr, | |||
int | linesize, | |||
int | uvlinesize, | |||
int | xchg, | |||
int | simple | |||
) | [inline, static] |
const uint8_t div6[52] [static] |
Initial value:
{ 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, }
Definition at line 50 of file h264.c.
Referenced by init_dequant4_coeff_table(), and init_dequant8_coeff_table().
Initial value:
{ "h264", AVMEDIA_TYPE_VIDEO, CODEC_ID_H264, sizeof(H264Context), ff_h264_decode_init, NULL, ff_h264_decode_end, decode_frame, CODEC_CAP_DR1 | CODEC_CAP_DELAY, .flush= flush_dpb, .long_name = NULL_IF_CONFIG_SMALL("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"), .pix_fmts= ff_hwaccel_pixfmt_list_420, }
const uint8_t rem6[52] [static] |
Initial value:
{ 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, }
Definition at line 46 of file h264.c.
Referenced by init_dequant4_coeff_table(), and init_dequant8_coeff_table().