h264_refs.c File Reference

H.264 / AVC / MPEG4 part10 reference picture handling. More...

#include "libavutil/avassert.h"
#include "internal.h"
#include "avcodec.h"
#include "h264.h"
#include "golomb.h"
#include <assert.h>
Include dependency graph for h264_refs.c:

Go to the source code of this file.

Macros

#define COPY_PICTURE(dst, src)
 

Functions

static void pic_as_field (Picture *pic, const int parity)
 
static int split_field_copy (Picture *dest, Picture *src, int parity, int id_add)
 
static int build_def_list (Picture *def, Picture **in, int len, int is_long, int sel)
 
static int add_sorted (Picture **sorted, Picture **src, int len, int limit, int dir)
 
int ff_h264_fill_default_ref_list (H264Context *h)
 Fill the default_ref_list. More...
 
static void print_short_term (H264Context *h)
 print short term list More...
 
static void print_long_term (H264Context *h)
 print long term list More...
 
static int pic_num_extract (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...
 
int ff_h264_decode_ref_pic_list_reordering (H264Context *h)
 
void ff_h264_fill_mbaff_ref_list (H264Context *h)
 
static int unreference_pic (H264Context *h, Picture *pic, int refmask)
 Mark a picture as no longer needed for reference. More...
 
static Picturefind_short (H264Context *h, int frame_num, int *idx)
 Find a Picture 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 Pictureremove_short (H264Context *h, int frame_num, int ref_mask)
 
static Pictureremove_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 int check_opcodes (MMCO *mmco1, MMCO *mmco2, int n_mmcos)
 
int ff_generate_sliding_window_mmcos (H264Context *h, int first_slice)
 
int ff_h264_execute_ref_pic_marking (H264Context *h, MMCO *mmco, int mmco_count)
 Execute the reference picture marking (memory management control operations). More...
 
int ff_h264_decode_ref_pic_marking (H264Context *h, GetBitContext *gb, int first_slice)
 

Detailed Description

H.264 / AVC / MPEG4 part10 reference picture handling.

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

Definition in file h264_refs.c.

Macro Definition Documentation

#define COPY_PICTURE (   dst,
  src 
)
Value:
do {\
*(dst) = *(src);\
(dst)->f.extended_data = (dst)->f.data;\
(dst)->tf.f = &(dst)->f;\
} while (0)
Sinusoidal phase f
#define tf
Definition: regdef.h:73
AVS_Value src
Definition: avisynth_c.h:523
else dst[i][x+y *dst_stride[i]]
Definition: vf_mcdeint.c:160

Definition at line 37 of file h264_refs.c.

Referenced by ff_h264_decode_ref_pic_list_reordering(), ff_h264_fill_default_ref_list(), ff_h264_fill_mbaff_ref_list(), and split_field_copy().

Function Documentation

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

Definition at line 95 of file h264_refs.c.

Referenced by ff_h264_fill_default_ref_list().

static int build_def_list ( Picture def,
Picture **  in,
int  len,
int  is_long,
int  sel 
)
static

Definition at line 72 of file h264_refs.c.

Referenced by ff_h264_fill_default_ref_list().

static int check_opcodes ( MMCO mmco1,
MMCO mmco2,
int  n_mmcos 
)
static
int ff_generate_sliding_window_mmcos ( H264Context h,
int  first_slice 
)

Definition at line 531 of file h264_refs.c.

Referenced by decode_slice_header(), and ff_h264_decode_ref_pic_marking().

int ff_h264_decode_ref_pic_list_reordering ( H264Context h)

Definition at line 205 of file h264_refs.c.

Referenced by decode_slice_header().

int ff_h264_decode_ref_pic_marking ( H264Context h,
GetBitContext gb,
int  first_slice 
)

Definition at line 745 of file h264_refs.c.

Referenced by decode_slice_header().

int ff_h264_execute_ref_pic_marking ( H264Context h,
MMCO mmco,
int  mmco_count 
)

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

Definition at line 563 of file h264_refs.c.

Referenced by decode_slice_header(), decode_update_thread_context(), and field_end().

int ff_h264_fill_default_ref_list ( H264Context h)

Fill the default_ref_list.

Definition at line 117 of file h264_refs.c.

Referenced by decode_slice_header().

void ff_h264_fill_mbaff_ref_list ( H264Context h)

Definition at line 327 of file h264_refs.c.

Referenced by decode_slice_header().

void ff_h264_remove_all_refs ( H264Context h)

Definition at line 463 of file h264_refs.c.

Referenced by h264_decode_end(), and idr().

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

Find a Picture 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 389 of file h264_refs.c.

Referenced by ff_h264_execute_ref_pic_marking(), and remove_short().

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

Definition at line 45 of file h264_refs.c.

Referenced by ff_h264_decode_ref_pic_list_reordering(), and split_field_copy().

static int pic_num_extract ( 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 192 of file h264_refs.c.

Referenced by ff_h264_decode_ref_pic_list_reordering(), and ff_h264_execute_ref_pic_marking().

static void print_long_term ( H264Context h)
static
static void print_short_term ( H264Context h)
static
static Picture* 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 446 of file h264_refs.c.

Referenced by ff_h264_execute_ref_pic_marking(), and ff_h264_remove_all_refs().

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

Definition at line 424 of file h264_refs.c.

Referenced by ff_h264_execute_ref_pic_marking().

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 411 of file h264_refs.c.

Referenced by ff_h264_execute_ref_pic_marking(), and remove_short().

static int split_field_copy ( Picture dest,
Picture src,
int  parity,
int  id_add 
)
static

Definition at line 56 of file h264_refs.c.

Referenced by build_def_list().

static int unreference_pic ( H264Context h,
Picture 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 366 of file h264_refs.c.

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