FFmpeg
Functions
h264_refs.c File Reference
#include <inttypes.h>
#include "libavutil/avassert.h"
#include "avcodec.h"
#include "h264.h"
#include "h264dec.h"
#include "golomb.h"
#include "mpegutils.h"
#include <assert.h>

Go to the source code of this file.

Functions

static void pic_as_field (H264Ref *pic, const int parity)
 
static void ref_from_h264pic (H264Ref *dst, const H264Picture *src)
 
static int split_field_copy (H264Ref *dest, const H264Picture *src, int parity, int id_add)
 
static int build_def_list (H264Ref *def, int def_len, H264Picture *const *in, int len, int is_long, int sel)
 
static int add_sorted (H264Picture **sorted, H264Picture *const *src, int len, int limit, int dir)
 
static int mismatches_ref (const H264Context *h, const H264Picture *pic)
 
static void h264_initialise_ref_list (H264Context *h, H264SliceContext *sl)
 
static void print_short_term (const H264Context *h)
 print short term list More...
 
static void print_long_term (const H264Context *h)
 print long term list More...
 
static int pic_num_extract (const H264Context *h, int pic_num, int *structure)
 Extract structure information about the picture described by pic_num in the current decoding context (frame or field). More...
 
static void h264_fill_mbaff_ref_list (H264SliceContext *sl)
 
int ff_h264_build_ref_list (H264Context *h, H264SliceContext *sl)
 
int ff_h264_decode_ref_pic_list_reordering (H264SliceContext *sl, void *logctx)
 
static int unreference_pic (H264Context *h, H264Picture *pic, int refmask)
 Mark a picture as no longer needed for reference. More...
 
static H264Picturefind_short (H264Context *h, int frame_num, int *idx)
 Find a H264Picture in the short term reference list by frame number. More...
 
static void remove_short_at_index (H264Context *h, int i)
 Remove a picture from the short term reference list by its index in that list. More...
 
static H264Pictureremove_short (H264Context *h, int frame_num, int ref_mask)
 
static H264Pictureremove_long (H264Context *h, int i, int ref_mask)
 Remove a picture from the long term reference list by its index in that list. More...
 
void ff_h264_remove_all_refs (H264Context *h)
 
static void generate_sliding_window_mmcos (H264Context *h)
 
int ff_h264_execute_ref_pic_marking (H264Context *h)
 Execute the reference picture marking (memory management control operations). More...
 
int ff_h264_decode_ref_pic_marking (H264SliceContext *sl, GetBitContext *gb, const H2645NAL *nal, void *logctx)
 

Detailed Description

H.264 / AVC / MPEG-4 part10 reference picture handling.

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

Definition in file h264_refs.c.

Function Documentation

◆ pic_as_field()

static void pic_as_field ( H264Ref pic,
const int  parity 
)
static

Definition at line 39 of file h264_refs.c.

Referenced by ff_h264_build_ref_list(), and split_field_copy().

◆ ref_from_h264pic()

static void ref_from_h264pic ( H264Ref dst,
const H264Picture src 
)
static

Definition at line 51 of file h264_refs.c.

Referenced by ff_h264_build_ref_list(), and split_field_copy().

◆ split_field_copy()

static int split_field_copy ( H264Ref dest,
const H264Picture src,
int  parity,
int  id_add 
)
static

Definition at line 61 of file h264_refs.c.

Referenced by build_def_list().

◆ build_def_list()

static int build_def_list ( H264Ref def,
int  def_len,
H264Picture *const *  in,
int  len,
int  is_long,
int  sel 
)
static

Definition at line 78 of file h264_refs.c.

Referenced by h264_initialise_ref_list().

◆ add_sorted()

static int add_sorted ( H264Picture **  sorted,
H264Picture *const *  src,
int  len,
int  limit,
int  dir 
)
static

Definition at line 104 of file h264_refs.c.

Referenced by h264_initialise_ref_list().

◆ mismatches_ref()

static int mismatches_ref ( const H264Context h,
const H264Picture pic 
)
static

Definition at line 127 of file h264_refs.c.

Referenced by ff_h264_build_ref_list(), and h264_initialise_ref_list().

◆ h264_initialise_ref_list()

static void h264_initialise_ref_list ( H264Context h,
H264SliceContext sl 
)
static

Definition at line 135 of file h264_refs.c.

Referenced by ff_h264_build_ref_list().

◆ print_short_term()

static void print_short_term ( const H264Context h)
static

print short term list

Definition at line 220 of file h264_refs.c.

Referenced by ff_h264_build_ref_list(), and ff_h264_execute_ref_pic_marking().

◆ print_long_term()

static void print_long_term ( const H264Context h)
static

print long term list

Definition at line 236 of file h264_refs.c.

Referenced by ff_h264_build_ref_list(), and ff_h264_execute_ref_pic_marking().

◆ pic_num_extract()

static int pic_num_extract ( const H264Context h,
int  pic_num,
int structure 
)
static

Extract structure information about the picture described by pic_num in the current decoding context (frame or field).

Note that pic_num is picture number without wrapping (so, 0<=pic_num<max_pic_num).

Parameters
pic_numpicture number for which to extract structure information
structureone of PICT_XXX describing structure of picture with pic_num
Returns
frame number (short term) or long term index of picture described by pic_num

Definition at line 261 of file h264_refs.c.

Referenced by ff_h264_build_ref_list(), and ff_h264_execute_ref_pic_marking().

◆ h264_fill_mbaff_ref_list()

static void h264_fill_mbaff_ref_list ( H264SliceContext sl)
static

Definition at line 274 of file h264_refs.c.

Referenced by ff_h264_build_ref_list().

◆ ff_h264_build_ref_list()

int ff_h264_build_ref_list ( H264Context h,
H264SliceContext sl 
)

Definition at line 299 of file h264_refs.c.

Referenced by h264_slice_init().

◆ ff_h264_decode_ref_pic_list_reordering()

int ff_h264_decode_ref_pic_list_reordering ( H264SliceContext sl,
void *  logctx 
)

Definition at line 434 of file h264_refs.c.

Referenced by h264_slice_header_parse().

◆ unreference_pic()

static int unreference_pic ( H264Context h,
H264Picture pic,
int  refmask 
)
inlinestatic

Mark a picture as no longer needed for reference.

The refmask argument allows unreferencing of individual fields or the whole frame. If the picture becomes entirely unreferenced, but is being held for display purposes, it is marked as such.

Parameters
refmaskmask of fields to unreference; the mask is bitwise anded with the reference marking of pic
Returns
non-zero if pic becomes entirely unreferenced (except possibly for display purposes) zero if one of the fields remains in reference

Definition at line 480 of file h264_refs.c.

Referenced by ff_h264_remove_all_refs(), remove_long(), and remove_short().

◆ find_short()

static H264Picture* find_short ( H264Context h,
int  frame_num,
int idx 
)
static

Find a H264Picture in the short term reference list by frame number.

Parameters
frame_numframe number to search for
idxthe index into h->short_ref where returned picture is found undefined if no picture found.
Returns
pointer to the found picture, or NULL if no pic with the provided frame number is found

Definition at line 503 of file h264_refs.c.

Referenced by ff_h264_execute_ref_pic_marking(), and remove_short().

◆ remove_short_at_index()

static void remove_short_at_index ( H264Context h,
int  i 
)
static

Remove a picture from the short term reference list by its index in that list.

This does no checking on the provided index; it is assumed to be valid. Other list entries are shifted down.

Parameters
iindex into h->short_ref of picture to remove.

Definition at line 525 of file h264_refs.c.

Referenced by ff_h264_execute_ref_pic_marking(), and remove_short().

◆ remove_short()

static H264Picture* remove_short ( H264Context h,
int  frame_num,
int  ref_mask 
)
static
Returns
the removed picture or NULL if an error occurs

Definition at line 537 of file h264_refs.c.

Referenced by ff_h264_execute_ref_pic_marking().

◆ remove_long()

static H264Picture* remove_long ( H264Context h,
int  i,
int  ref_mask 
)
static

Remove a picture from the long term reference list by its index in that list.

Returns
the removed picture or NULL if an error occurs

Definition at line 559 of file h264_refs.c.

Referenced by ff_h264_execute_ref_pic_marking(), and ff_h264_remove_all_refs().

◆ ff_h264_remove_all_refs()

void ff_h264_remove_all_refs ( H264Context h)

Definition at line 576 of file h264_refs.c.

Referenced by h264_decode_end(), and idr().

◆ generate_sliding_window_mmcos()

static void generate_sliding_window_mmcos ( H264Context h)
static

Definition at line 599 of file h264_refs.c.

Referenced by ff_h264_execute_ref_pic_marking().

◆ ff_h264_execute_ref_pic_marking()

int ff_h264_execute_ref_pic_marking ( H264Context h)

Execute the reference picture marking (memory management control operations).

Definition at line 621 of file h264_refs.c.

Referenced by ff_h264_field_end(), ff_h264_update_thread_context(), and h264_field_start().

◆ ff_h264_decode_ref_pic_marking()

int ff_h264_decode_ref_pic_marking ( H264SliceContext sl,
GetBitContext gb,
const H2645NAL nal,
void *  logctx 
)

Definition at line 845 of file h264_refs.c.

Referenced by h264_slice_header_parse().