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

H.264 / AVC / MPEG-4 part10 codec. More...

#include "config_components.h"
#include "libavutil/attributes.h"
#include "libavutil/avassert.h"
#include "libavutil/emms.h"
#include "libavutil/imgutils.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/thread.h"
#include "libavutil/video_enc_params.h"
#include "codec_internal.h"
#include "internal.h"
#include "error_resilience.h"
#include "avcodec.h"
#include "h264.h"
#include "h264dec.h"
#include "h2645_parse.h"
#include "h264data.h"
#include "h264_ps.h"
#include "golomb.h"
#include "hwaccel_internal.h"
#include "hwconfig.h"
#include "mpegutils.h"
#include "profiles.h"
#include "rectangle.h"
#include "libavutil/refstruct.h"
#include "thread.h"
#include "threadframe.h"

Go to the source code of this file.

Macros

#define UNCHECKED_BITSTREAM_READER   1
 
#define OFFSET(x)
 
#define VD   AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
 
#define VDX   VD | AV_OPT_FLAG_EXPORT
 

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 (const H264Context *h, H264SliceContext *sl, int y, int height)
 
void ff_h264_free_tables (H264Context *h)
 
int ff_h264_alloc_tables (H264Context *h)
 Allocate tables.
 
void ff_h264_slice_context_init (H264Context *h, H264SliceContext *sl)
 Init slice context.
 
static int h264_init_pic (H264Picture *pic)
 
static int h264_init_context (AVCodecContext *avctx, H264Context *h)
 
static void h264_free_pic (H264Context *h, H264Picture *pic)
 
static av_cold int h264_decode_end (AVCodecContext *avctx)
 
static av_cold int h264_decode_init (AVCodecContext *avctx)
 
static void idr (H264Context *h)
 instantaneous decoder refresh.
 
void ff_h264_flush_change (H264Context *h)
 
static av_cold void h264_decode_flush (AVCodecContext *avctx)
 
static int get_last_needed_nal (H264Context *h)
 
static void debug_green_metadata (const H264SEIGreenMetaData *gm, void *logctx)
 
static int decode_nal_units (H264Context *h, AVBufferRef *buf_ref, const uint8_t *buf, int buf_size)
 
static int h264_export_enc_params (AVFrame *f, const H264Picture *p)
 
static int output_frame (H264Context *h, AVFrame *dst, H264Picture *srcp)
 
static int is_avcc_extradata (const uint8_t *buf, int buf_size)
 
static int finalize_frame (H264Context *h, AVFrame *dst, H264Picture *out, int *got_frame)
 
static int send_next_delayed_frame (H264Context *h, AVFrame *dst_frame, int *got_frame, int buf_index)
 
static int h264_decode_frame (AVCodecContext *avctx, AVFrame *pict, int *got_frame, AVPacket *avpkt)
 

Variables

const uint16_t ff_h264_mb_sizes [4] = { 256, 384, 512, 768 }
 
static AVOnce h264_vlc_init = AV_ONCE_INIT
 
static const AVOption h264_options []
 
static const AVClass h264_class
 
const FFCodec ff_h264_decoder
 

Detailed Description

H.264 / AVC / MPEG-4 part10 codec.

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

Definition in file h264dec.c.

Macro Definition Documentation

◆ UNCHECKED_BITSTREAM_READER

#define UNCHECKED_BITSTREAM_READER   1

Definition at line 28 of file h264dec.c.

◆ OFFSET

#define OFFSET ( x)
Value:
offsetof(H264Context, x)
H264Context.
Definition h264dec.h:338

Definition at line 1089 of file h264dec.c.

◆ VD

Definition at line 1090 of file h264dec.c.

◆ VDX

#define VDX   VD | AV_OPT_FLAG_EXPORT

Definition at line 1091 of file h264dec.c.

Function Documentation

◆ avpriv_h264_has_num_reorder_frames()

int avpriv_h264_has_num_reorder_frames ( AVCodecContext * avctx)

Definition at line 62 of file h264dec.c.

Referenced by has_decode_delay_been_guessed().

◆ h264_er_decode_mb()

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 )
static

Definition at line 68 of file h264dec.c.

Referenced by ff_h264_alloc_tables().

◆ ff_h264_draw_horiz_band()

void ff_h264_draw_horiz_band ( const H264Context * h,
H264SliceContext * sl,
int y,
int height )

◆ ff_h264_free_tables()

void ff_h264_free_tables ( H264Context * h)

Definition at line 142 of file h264dec.c.

Referenced by h264_decode_end(), h264_decode_flush(), and h264_slice_header_init().

◆ ff_h264_alloc_tables()

int ff_h264_alloc_tables ( H264Context * h)

Allocate tables.

needs width/height

Definition at line 187 of file h264dec.c.

Referenced by h264_slice_header_init().

◆ ff_h264_slice_context_init()

void ff_h264_slice_context_init ( H264Context * h,
H264SliceContext * sl )

Init slice context.

Definition at line 264 of file h264dec.c.

Referenced by h264_slice_header_init().

◆ h264_init_pic()

static int h264_init_pic ( H264Picture * pic)
static

Definition at line 276 of file h264dec.c.

Referenced by h264_init_context().

◆ h264_init_context()

static int h264_init_context ( AVCodecContext * avctx,
H264Context * h )
static

Definition at line 289 of file h264dec.c.

Referenced by h264_decode_init().

◆ h264_free_pic()

static void h264_free_pic ( H264Context * h,
H264Picture * pic )
static

Definition at line 344 of file h264dec.c.

Referenced by h264_decode_end().

◆ h264_decode_end()

static av_cold int h264_decode_end ( AVCodecContext * avctx)
static

Definition at line 351 of file h264dec.c.

◆ h264_decode_init()

static av_cold int h264_decode_init ( AVCodecContext * avctx)
static

Definition at line 384 of file h264dec.c.

◆ idr()

static void idr ( H264Context * h)
static

instantaneous decoder refresh.

Definition at line 438 of file h264dec.c.

Referenced by decode_nal_units(), ff_h264_flush_change(), ff_isom_write_lvcc(), and h264_probe().

◆ ff_h264_flush_change()

void ff_h264_flush_change ( H264Context * h)

Definition at line 451 of file h264dec.c.

Referenced by h264_decode_flush(), h264_decode_init(), and h264_init_ps().

◆ h264_decode_flush()

static av_cold void h264_decode_flush ( AVCodecContext * avctx)
static

Definition at line 476 of file h264dec.c.

◆ get_last_needed_nal()

static int get_last_needed_nal ( H264Context * h)
static

Definition at line 501 of file h264dec.c.

Referenced by decode_nal_units().

◆ debug_green_metadata()

static void debug_green_metadata ( const H264SEIGreenMetaData * gm,
void * logctx )
static

Definition at line 555 of file h264dec.c.

Referenced by decode_nal_units().

◆ decode_nal_units()

static int decode_nal_units ( H264Context * h,
AVBufferRef * buf_ref,
const uint8_t * buf,
int buf_size )
static

< number of NALs that need decoding before the next frame thread starts

Definition at line 583 of file h264dec.c.

Referenced by h264_decode_frame().

◆ h264_export_enc_params()

static int h264_export_enc_params ( AVFrame * f,
const H264Picture * p )
static

Definition at line 826 of file h264dec.c.

Referenced by output_frame().

◆ output_frame()

◆ is_avcc_extradata()

static int is_avcc_extradata ( const uint8_t * buf,
int buf_size )
static

Definition at line 899 of file h264dec.c.

Referenced by h264_decode_frame().

◆ finalize_frame()

static int finalize_frame ( H264Context * h,
AVFrame * dst,
H264Picture * out,
int * got_frame )
static

Definition at line 923 of file h264dec.c.

Referenced by h264_decode_frame(), and send_next_delayed_frame().

◆ send_next_delayed_frame()

static int send_next_delayed_frame ( H264Context * h,
AVFrame * dst_frame,
int * got_frame,
int buf_index )
static

Definition at line 978 of file h264dec.c.

Referenced by h264_decode_frame().

◆ h264_decode_frame()

static int h264_decode_frame ( AVCodecContext * avctx,
AVFrame * pict,
int * got_frame,
AVPacket * avpkt )
static

Definition at line 1019 of file h264dec.c.

Variable Documentation

◆ ff_h264_mb_sizes

const uint16_t ff_h264_mb_sizes[4] = { 256, 384, 512, 768 }

Definition at line 60 of file h264dec.c.

Referenced by ff_h264_decode_mb_cabac(), ff_h264_decode_mb_cavlc(), and hl_decode_mb().

◆ h264_vlc_init

AVOnce h264_vlc_init = AV_ONCE_INIT
static

Definition at line 382 of file h264dec.c.

Referenced by h264_decode_init().

◆ h264_options

const AVOption h264_options[]
static
Initial value:
= {
{ "is_avc", "is avc", OFFSET(is_avc), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, VDX },
{ "nal_length_size", "nal_length_size", OFFSET(nal_length_size), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 4, VDX },
{ "enable_er", "Enable error resilience on damaged frames (unsafe)", OFFSET(enable_er), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, VD },
{ "x264_build", "Assume this x264 version if no x264 version found in any SEI", OFFSET(x264_build), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VD },
{ "skip_gray", "Do not return gray gap frames", OFFSET(skip_gray), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, VD },
{ "noref_gray", "Avoid using gray gap frames as references", OFFSET(noref_gray), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, VD },
{ NULL },
}
#define VD
Definition amfdec.c:787
#define NULL
Definition coverity.c:32
#define OFFSET(x)
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition opt.h:326
#define VDX
Definition h264dec.c:1091

Definition at line 1092 of file h264dec.c.

◆ h264_class

const AVClass h264_class
static
Initial value:
= {
.class_name = "H264 Decoder",
.item_name = av_default_item_name,
.option = h264_options,
}
const char * av_default_item_name(void *ptr)
Return the context name.
Definition log.c:241
#define LIBAVUTIL_VERSION_INT
Definition version.h:85
static const AVOption h264_options[]
Definition h264dec.c:1092

Definition at line 1102 of file h264dec.c.

◆ ff_h264_decoder

const FFCodec ff_h264_decoder

Definition at line 1109 of file h264dec.c.

Referenced by imm5_init().