FFmpeg
|
H.264 / AVC / MPEG4 part10 codec. More...
#include "libavutil/avassert.h"
#include "libavutil/display.h"
#include "libavutil/imgutils.h"
#include "libavutil/opt.h"
#include "libavutil/stereo3d.h"
#include "libavutil/timer.h"
#include "internal.h"
#include "cabac.h"
#include "cabac_functions.h"
#include "dsputil.h"
#include "error_resilience.h"
#include "avcodec.h"
#include "h264.h"
#include "h264data.h"
#include "h264chroma.h"
#include "h264_mvpred.h"
#include "golomb.h"
#include "mathops.h"
#include "mpegutils.h"
#include "rectangle.h"
#include "svq3.h"
#include "thread.h"
#include "vdpau_internal.h"
#include <assert.h>
Go to the source code of this file.
Macros | |
#define | UNCHECKED_BITSTREAM_READER 1 |
#define | STARTCODE_TEST |
Functions | |
int | avpriv_h264_has_num_reorder_frames (AVCodecContext *avctx) |
static void | h264_er_decode_mb (void *opaque, int ref, int mv_dir, int mv_type, int(*mv)[2][4][2], int mb_x, int mb_y, int mb_intra, int mb_skipped) |
void | ff_h264_draw_horiz_band (H264Context *h, int y, int height) |
int | ff_h264_check_intra4x4_pred_mode (H264Context *h) |
Check if the top & left blocks are available if needed and change the dc mode so it only uses the available blocks. | |
int | ff_h264_check_intra_pred_mode (H264Context *h, int mode, int is_chroma) |
Check if the top & left blocks are available if needed and change 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) |
Decode a network abstraction layer unit. | |
static int | decode_rbsp_trailing (H264Context *h, const uint8_t *src) |
Identify the exact end of the bitstream. | |
void | ff_h264_free_tables (H264Context *h, int free_rbsp) |
int | ff_h264_alloc_tables (H264Context *h) |
Allocate tables. | |
int | ff_h264_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, int parse_extradata) |
int | ff_h264_decode_extradata (H264Context *h, const uint8_t *buf, int size) |
av_cold int | ff_h264_decode_init (AVCodecContext *avctx) |
static int | decode_init_thread_copy (AVCodecContext *avctx) |
static void | decode_postinit (H264Context *h, int setup_finished) |
Run setup operations that must be run after slice header decoding. | |
int | ff_pred_weight_table (H264Context *h) |
static void | idr (H264Context *h) |
instantaneous decoder refresh. | |
void | ff_h264_flush_change (H264Context *h) |
static void | flush_dpb (AVCodecContext *avctx) |
int | ff_init_poc (H264Context *h, int pic_field_poc[2], int *pic_poc) |
int | ff_h264_get_profile (SPS *sps) |
Compute profile from profile_idc and constraint_set?_flags. | |
int | ff_h264_set_parameter_from_sps (H264Context *h) |
int | ff_set_ref_count (H264Context *h) |
static int | find_start_code (const uint8_t *buf, int buf_size, int buf_index, int next_avc) |
static int | get_avc_nalsize (H264Context *h, const uint8_t *buf, int buf_size, int *buf_index) |
static int | get_bit_length (H264Context *h, const uint8_t *buf, const uint8_t *ptr, int dst_length, int i, int next_avc) |
static int | get_last_needed_nal (H264Context *h, const uint8_t *buf, int buf_size) |
static int | get_consumed_bytes (int pos, int buf_size) |
Return the number of bytes consumed for building the current frame. | |
static int | output_frame (H264Context *h, AVFrame *dst, H264Picture *srcp) |
static int | h264_decode_frame (AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) |
av_cold void | ff_h264_free_context (H264Context *h) |
Free any data that may have been allocated in the H264 context like SPS, PPS etc. | |
static av_cold int | h264_decode_end (AVCodecContext *avctx) |
Variables | |
const uint16_t | ff_h264_mb_sizes [4] = { 256, 384, 512, 768 } |
static const uint8_t | start_code [] = { 0x00, 0x00, 0x01 } |
static const AVProfile | profiles [] |
static const AVOption | h264_options [] |
static const AVClass | h264_class |
static const AVClass | h264_vdpau_class |
AVCodec | ff_h264_decoder |
H.264 / AVC / MPEG4 part10 codec.
Definition in file h264.c.
#define STARTCODE_TEST |
Referenced by ff_h264_decode_nal(), and ff_hevc_extract_rbsp().
int avpriv_h264_has_num_reorder_frames | ( | AVCodecContext * | avctx | ) |
Definition at line 58 of file h264.c.
Referenced by has_decode_delay_been_guessed().
|
static |
Definition at line 64 of file h264.c.
Referenced by ff_h264_context_init().
void ff_h264_draw_horiz_band | ( | H264Context * | h, |
int | y, | ||
int | height | ||
) |
Definition at line 99 of file h264.c.
Referenced by decode_finish_row(), dxva2_h264_end_frame(), vaapi_h264_end_frame(), and vdpau_h264_end_frame().
int ff_h264_check_intra4x4_pred_mode | ( | H264Context * | h | ) |
Check if the top & left blocks are available if needed and change the dc mode so it only uses the available blocks.
Check if the top & left blocks are available if needed & change the dc mode so it only uses the available blocks.
Definition at line 147 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, | ||
int | is_chroma | ||
) |
Check if the top & left blocks are available if needed and change the dc mode so it only uses the available blocks.
Check if the top & left blocks are available if needed & change the dc mode so it only uses the available blocks.
Definition at line 194 of file h264.c.
Referenced by ff_h264_decode_mb_cabac(), ff_h264_decode_mb_cavlc(), and svq3_decode_mb().
const uint8_t* ff_h264_decode_nal | ( | H264Context * | h, |
const uint8_t * | src, | ||
int * | dst_length, | ||
int * | consumed, | ||
int | length | ||
) |
Decode 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 235 of file h264.c.
Referenced by decode_nal_units(), get_last_needed_nal(), and parse_nal_units().
|
static |
Identify the exact end of the bitstream.
Definition at line 353 of file h264.c.
Referenced by get_bit_length().
void ff_h264_free_tables | ( | H264Context * | h, |
int | free_rbsp | ||
) |
Definition at line 368 of file h264.c.
Referenced by ff_h264_alloc_tables(), ff_h264_free_context(), flush_dpb(), and h264_slice_header_init().
int ff_h264_alloc_tables | ( | H264Context * | h | ) |
Allocate tables.
needs width/height
Definition at line 429 of file h264.c.
Referenced by ff_h264_update_thread_context(), h264_slice_header_init(), and svq3_decode_init().
int ff_h264_context_init | ( | H264Context * | h | ) |
Init context Allocate buffers which are not shared amongst multiple threads.
Definition at line 494 of file h264.c.
Referenced by ff_h264_update_thread_context(), and h264_slice_header_init().
|
static |
< thread context
< number of NALs that need decoding before the next frame thread starts
Definition at line 1452 of file h264.c.
Referenced by ff_h264_decode_extradata(), and h264_decode_frame().
int ff_h264_decode_extradata | ( | H264Context * | h, |
const uint8_t * | buf, | ||
int | size | ||
) |
Definition at line 566 of file h264.c.
Referenced by ff_h264_decode_init(), h264_decode_frame(), and h264_parse().
av_cold int ff_h264_decode_init | ( | AVCodecContext * | avctx | ) |
Definition at line 628 of file h264.c.
Referenced by svq3_decode_init().
|
static |
|
static |
Run setup operations that must be run after slice header decoding.
This includes finding the next displayed frame.
h | h264 master context |
setup_finished | enough NALs have been read that we can call ff_thread_finish_setup() |
Definition at line 744 of file h264.c.
Referenced by decode_nal_units(), and h264_decode_frame().
int ff_pred_weight_table | ( | H264Context * | h | ) |
Definition at line 983 of file h264.c.
Referenced by ff_h264_decode_slice_header(), and scan_mmco_reset().
|
static |
instantaneous decoder refresh.
Definition at line 1048 of file h264.c.
Referenced by decode_nal_units(), ff_h264_flush_change(), and h264_probe().
void ff_h264_flush_change | ( | H264Context * | h | ) |
Definition at line 1061 of file h264.c.
Referenced by ff_h264_decode_init(), ff_h264_decode_slice_header(), and flush_dpb().
|
static |
int ff_init_poc | ( | H264Context * | h, |
int | pic_field_poc[2], | ||
int * | pic_poc | ||
) |
Definition at line 1123 of file h264.c.
Referenced by ff_h264_decode_slice_header(), and parse_nal_units().
int ff_h264_get_profile | ( | SPS * | sps | ) |
Compute profile from profile_idc and constraint_set?_flags.
compute profile from sps
sps | SPS |
Definition at line 1208 of file h264.c.
Referenced by ff_h264_decode_slice_header(), and parse_nal_units().
int ff_h264_set_parameter_from_sps | ( | H264Context * | h | ) |
Definition at line 1228 of file h264.c.
Referenced by ff_h264_decode_slice_header(), and ff_h264_update_thread_context().
int ff_set_ref_count | ( | H264Context * | h | ) |
Definition at line 1277 of file h264.c.
Referenced by ff_h264_decode_slice_header(), and scan_mmco_reset().
|
static |
Definition at line 1333 of file h264.c.
Referenced by decode_nal_units(), and get_last_needed_nal().
|
static |
Definition at line 1352 of file h264.c.
Referenced by decode_nal_units(), and get_last_needed_nal().
|
static |
Definition at line 1370 of file h264.c.
Referenced by decode_nal_units(), and get_last_needed_nal().
|
static |
Definition at line 1389 of file h264.c.
Referenced by decode_nal_units().
|
static |
Return the number of bytes consumed for building the current frame.
Definition at line 1783 of file h264.c.
Referenced by h264_decode_frame().
|
static |
Definition at line 1793 of file h264.c.
Referenced by h264_decode_frame(), and load_encode_and_write().
|
static |
av_cold void ff_h264_free_context | ( | H264Context * | h | ) |
Free any data that may have been allocated in the H264 context like SPS, PPS etc.
Definition at line 1943 of file h264.c.
Referenced by close(), ff_h264_decode_init(), h264_decode_end(), and svq3_decode_end().
|
static |
const uint16_t ff_h264_mb_sizes[4] = { 256, 384, 512, 768 } |
Definition at line 56 of file h264.c.
Referenced by ff_h264_decode_mb_cabac(), ff_h264_decode_mb_cavlc(), and hl_decode_mb().
|
static |
Definition at line 1331 of file h264.c.
Referenced by commit_bitstream_and_slice_buffer(), decode_chunks(), ff_mjpeg_decode_frame(), ff_mjpeg_find_marker(), ff_msmpeg4_decode_picture_header(), ff_rtp_send_mpegvideo(), mpeg_decode_slice(), mpegvideo_extract_headers(), mxpeg_decode_frame(), and slice_decode_thread().
|
static |
|
static |
|
static |
|
static |
AVCodec ff_h264_decoder |